<?php
namespace home\Controller;
use Think\Controller;
class IndexController extends Controller {
	public function _initialize(){
		$uid=session('uu.uid');
		if(!$uid){
//			这里还要再次判断ajax获取用户 判断那边服务器域名的用户session_id存不存在
//			$r_url="http://www.zgxmall.com/index.php?app=test&sld_addons=has_id";
//            $has_u=$this->_request($r_url);
//			var_dump($has_u);exit();
//			$url="http://dev.zgxmall.com/index.php?app=login&ref_url=%2Findex.php%3Fapp%3Dtest";
//			@header("Location: " .$url);
		}
		if (C('UU_CLOSE')=='1')
		{
		$shut='<div style=" width:500px; padding:50px; border:1px #FF9900 solid; margin:0 auto; margin-top:50px;background-color:#FDFEE7; line-height:180%;font-family:microsoft yahei;"><div style=" text-align: center; height:50px;font-size:20px;">网站关闭中</div>'.C('UU_CLOSE_DESCRIPTION').'</div>';
		$this->show($shut);
		exit();
		}
	}
    public function index(){
		$this->assign('page_as','home');
        $this->display();
    }

	public function test(){
//		//这里还要判断是否存在用户 没有就增加  有就更新积分
		$phone = I('get.phone');
		$user=D('User')->where(array('mobile'=>$phone))->find();
		$a=D('User')->make_session($user['uid']);
		$url="http://hzf.wenjuncheng.top:8088";
		@header("Location: " .$url);
	}

	function _request($curl, $https=true, $method='get', $data=null,$header=''){
		$ch = curl_init();//初始化
		curl_setopt($ch, CURLOPT_URL, $curl);//设置访问的URL

		if($header){curl_setopt($ch,CURLOPT_HTTPHEADER,$header);}else{curl_setopt($ch, CURLOPT_HEADER, false);}//设置不需要头信息
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//只获取页面
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  FALSE) ;
		if($https){
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//不做服务器认证
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//不做客户端认证
		}
		if($method == 'post'){
			curl_setopt($ch, CURLOPT_POST, true);//设置请求是POST方式
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));//设置POST请求的数据
		}
		$str = curl_exec($ch);//执行访问，返回结果
		curl_close($ch);//关闭curl，释放资源
		return $str;
	}


}
?>